<template>
    <div class="root">
            <div class="timehead">
                <div class="time">{{time}}</div>
            </div>
    </div>
</template>

<script>
export default {
    data(){
        return {
            time:''
        }
    },
    methods:{
        gettime(){
            const time = new Date()
            setInterval(() => {
                let hour = time.getHours()
                let min = time.getMinutes()
                if(hour <= 9){
                    hour = '0'+hour
                }
                if(min <= 9){
                    min = '0'+min
                }
                this.time = `${hour}:${min}`
            }, 1000);
        }
    },
    created(){
        this.gettime() 
    }
}
</script>

<style lang="less" scoped>
    .root{
        width: 100vw;
        // height: 100vh;
        height: 25px;
        display: flex;
        justify-content: center;
    }
    .timehead{
        width: 100%;
        // height: 30px;
        // background-color: #fff;
        background: none;
        display: flex;
        color: rgb(69, 69, 69);
        justify-content: center;
        align-items: center;
    }
</style>
